package HomeWork01;

public class Test04 {
        public static void meeting(Person2... ps){
            for (int i = 0; i < ps.length; i++) {
                ps[i].eat();
                ps[i].toilet();
                if(ps[i] instanceof Woman2){
                    ((Woman2)ps[i]).makeup();
                }else if(ps[i] instanceof Man2){
                    ((Man2)ps[i]).smoke();
                }
            }
    }
    public static void main(String[] args) {
            meeting(new Man2(),new Woman2());

    }
}
class Person2{
    public void eat(){
        System.out.println("吃饭");
    }
    public void toilet(){
        System.out.println("上洗手间");
    }
}
class Man2 extends Person2{
    @Override
    public void eat() {
        super.eat();
    }

    @Override
    public void toilet() {
        super.toilet();
    }
    public void smoke(){
        System.out.println("抽烟");
    }
}
class Woman2 extends Man2{
    @Override
    public void eat() {
        super.eat();
    }

    @Override
    public void toilet() {
        super.toilet();
    }

    @Override
    public void smoke() {
        super.smoke();
    }
    public void makeup(){
        System.out.println("化妆");
    }
}